var app=getApp()
var moduleUrl=app.baseUrl+'/client/user'
Page({
  data: {
    function_list:[
      {
        name:"活动",
        url:"event/event",
        thumb:"/image/icon/活动管理.png"
      },
      {
        name:"积分",
        url:"credit/credit",
        thumb:"/image/icon/积分兑换.png"
      },
      {
        name:"收货地址",
        url:"address/list",
        thumb:"/image/icon/地址管理.png"
      }
    ],
    navUrl:{}
  },
  onLoad() {
    this.getUser(app.userId)
  },
  //获取用户基本信息
  getUser(userId){
    var that =this
    //查出所有处于报名阶段的活动
      dd.httpRequest({
        url: moduleUrl+'/'+userId,
        method: 'GET',
        success: function(res) {
        console.log(moduleUrl+'/'+userId,res)  
         that.setData({
           user_info:res.data.data
         })
        },
        fail: function(res) {
          // dd.alert({content: JSON.parse(res.originalData).rows'});
        },
        complete: function(res) {
          // dd.alert({content: 'complete'});
        }
      });
  },
  nav(e,comp){
    console.log("nav",comp)
    console.log("nav",e)
  },
  onItemClick(e) {
    const url = e.currentTarget.dataset.url;
    dd.navigateTo({
      // url: `/pages/${url}/${url}`
      url: `/pages/${url}`
    });
  },
  navToAddress() {
    dd.navigateTo({ url: '/pages/address/list' })
  }
});
